#include "../hle.h"

#include "../blkalloc.h"

#define KERNELMEMSTART 0x08000000
#define KERNELMEMEND   0x08800000
#define KERNELMEMSIZE  KERNELMEMEND - KERNELMEMSTART

#define USERMEMSTART 0x08800000
#define USERMEMEND   0x0a000000
#define USERMEMSIZE  USERMEMEND - USERMEMSTART

BlkAlloc kernelMemory;
BlkAlloc userMemory;

void __KernelMemoryInit()
{
    blkAlloc_init(&kernelMemory, KERNELMEMSTART, KERNELMEMSIZE, "kernel memory");
    blkAlloc_init(&userMemory, USERMEMSTART, USERMEMSIZE, "user memory");
    _log(INF, HLE, "Kernel and user memory pools initialized");
}

void __KernelMemoryShutdown()
{
    _log(INF, HLE, "Shutting down user memory pool :");
    blkAlloc_listBlocks(&userMemory);
    blkAlloc_shutdown(&userMemory);
    _log(INF, HLE, "Shutting down kernel memory pool :");
    blkAlloc_listBlocks(&kernelMemory);
    blkAlloc_shutdown(&kernelMemory);
}

